package com.test.myfirsttriangle;

import android.os.Bundle;


import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;

public class Main extends AndroidApplication {
	class MyFirstTest implements ApplicationListener {

		private Mesh mesh;

		public void create() {
			if (mesh == null) {
				mesh = new Mesh(true, 3, 3, new VertexAttribute(Usage.Position,
						3, "a_position"));

				mesh.setVertices(new float[] { -0.5f, -0.5f, 0, 0.5f, -0.5f, 0,
						0, 0.5f, 0 });
				mesh.setIndices(new short[] { 0, 1, 2 });
			}

		}

		public void dispose() {
			// TODO Auto-generated method stub

		}

		public void pause() {
			// TODO Auto-generated method stub

		}

		public void render() {
			Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
			mesh.render(GL10.GL_TRIANGLES, 0, 3);

		}

		public void resize(int arg0, int arg1) {
			// TODO Auto-generated method stub

		}

		public void resume() {
			// TODO Auto-generated method stub

		}

	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initialize(new MyFirstTest(), false);
	}
}